/*
 * @Author: Zhouhai 497675647@qq.com
 * @Date: 2022-11-24 17:15:54
 * @LastEditors: Zhouhai 497675647@qq.com
 * @LastEditTime: 2022-11-25 16:36:25
 */
/* eslint-disable @typescript-eslint/no-unused-vars */
import ResizeTable from '@/components/ResizeTable';
import { SysPostMenuDomain } from '@/type.d/system/postMenu';
import { arrTotreeNoPID } from '@/utils/tree';
import { ProColumns } from '@ant-design/pro-components';
import { Popconfirm } from 'antd';
import Tree, { DataNode } from 'antd/lib/tree';
import React from 'react'
import { FileTwoTone,FolderOpenTwoTone,FolderTwoTone } from '@ant-design/icons';

export type PostMenuProps = {
    dataSources?: any[],
}

const PostMenu: React.FC<PostMenuProps> = ({ dataSources = [] }) => {


    return (
        <Tree<DataNode>
            showIcon
            icon={(prop: any)=>{
                if(!prop.data.children){
                    return <FileTwoTone />
                }
                if(prop.expanded){
                    return <FolderOpenTwoTone />
                }else{
                    return <FolderTwoTone />
                }
                
            }}
            height={300}
            autoExpandParent
            defaultExpandAll={false}
            treeData={arrTotreeNoPID(dataSources, 'key', 'pkFather', 'children')}
        />
    )
}
export default PostMenu;